<?php

require_once './_merchant.inc';
require_once './_rsa.inc';

$n = 100;

$ss = selectorstr_gen($n);

/*
if(md5(implode(":",$mo)) == rsa_check_signature($signature, PUBLIC_KEY, MODULUS)){
	// Accept bank signature as valid.
}
*/

// Test data
for($i = 0; $i < $n; $i++){
	$id[$i][0] = (string)mt_rand(0, 1) . (string)mt_rand(0, 1) . (string)mt_rand(0, 1) . (string)mt_rand(0, 1) . (string)mt_rand(0, 1);
	$id[$i][1] = (string)mt_rand(0, 1) . (string)mt_rand(0, 1) . (string)mt_rand(0, 1) . (string)mt_rand(0, 1) . (string)mt_rand(0, 1);
	$id_h[$i][0] = md5($id[$i][0]);
	$id_h[$i][1] = md5($id[$i][1]);
} 
$mo["id_h"] = $id_h;

// Received ID string
for($i = 0; $i < $n; $i++)
	$id_given[$i] = $id[$i][$ss[$i]];

if(check_id_string($mo, $id_given, $ss))
	echo "The given ID strings are valid";
else
	echo "The given ID strings are invalid";

?>